/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.weed.helper;



import com.weed.common.Log;
import com.weed.core.WeedException;

/**
 * 函数说明：
 *    类助手。
 * @author  Jason Zhuo
 * @version 1.0
 */
public abstract class ClassHelper {
  static Log log = LogFactory.getLog(ClassHelper.class);
  /**
   * 初始化类对象。
   * @param clazz String
   * @return Object
   */
  public static Object newInstance(String clazz) throws WeedException{
    if (clazz == null || clazz.equals("")) {
      return null;
    }
    Object obj = null;
    try {
      Class object_class = Class.forName(clazz);
      obj = object_class.newInstance();
    }
    catch (Exception ex) {
      throw new WeedException("初始化对象发生异常["+clazz+"]",ex);
    }
    return obj;
  }
  public static void main(String[] args) {
    try {
      ClassHelper.newInstance("org.sun.package.Class");
    }
    catch (WeedException ex) {

    }
  }
}

